<?php 

$username = $_POST['username'];
$password = md5($_POST['password']);

$old = file_get_contents('./Db/user.txt');
//转数组
$old = json_decode($old,true);

foreach ($old as $k => $user) {

	if($user['username']==$username&&$user['password']==$password){

		session_start();
		$_SESSION['username'] = $username;
		echo json_encode(['error'=>0,'info'=>'登录成功']);exit;
	}
	
}

echo json_encode(['error'=>1,'info'=>'用户名或密码错误']);exit;




 ?>